package com.vip.elastic.controller;


import com.vip.common.response.RestResponse;
import com.vip.common.response.RestResponses;
import com.vip.elastic.service.IIndexService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 索引管理 控制器
 *
 * @author wgb
 * @date 2020/11/10 10:56
 */
@Slf4j
@RestController
@RequestMapping("/api/index")
@RequiredArgsConstructor
public class IndexController {

    private final IIndexService elasticService;

    /**
     * 删除索引
     *
     * @param index
     * @return
     */
    @DeleteMapping("/del/{index}")
    public RestResponse<String> deleteIndex(@PathVariable String index) {
        return RestResponses.newResponseFromResult(elasticService.deleteIndex(index));
    }

}


